﻿@{
    ViewBag.Title = "Index";
}
@model BenzInfo.Hockey.LHRAF.Models.Post

@{
    ViewBag.Title = (ViewBag.Lang.IndexOf("fr") >= 0) ? Model.TitleFR : Model.TitleEN;
}

<script type="text/javascript">

    $(document).ready(function () {
        $('#dialog_information').dialog({
            autoOpen: false,
            modal: true,
            draggable: false,
            resizable: false,
            width: 580,
            height: 'auto',
            buttons: [
                {
                    id: 'dialog_btn_save', text: '@BenzInfo.Hockey.LHRAF.Resources.Dictionary.Save',
                    click: function () {
                        $('form', this).submit();
                    }
                },
                {
                    id: 'dialog_btn_cancel', text: '@BenzInfo.Hockey.LHRAF.Resources.Dictionary.Cancel',
                    click: function () {
                        $(this).dialog('close');
                    }
                }
            ]
        });

        $('#btn_edit a').click(function () {
            var url = $(this).attr('href');
            var title = '@BenzInfo.Hockey.LHRAF.Resources.Dictionary.Edit';

            $('#dialog_btn_save span').html('@BenzInfo.Hockey.LHRAF.Resources.Dictionary.Save');

            $('#dialog_information').empty().load(url, function () {
                $('#dialog_information').dialog('option', 'title', title).dialog('open');
            });

            return false;
        });
    });

</script>
<br /><br />
<h1>@((ViewBag.Lang.IndexOf("fr") >= 0) ? Model.TitleFR : Model.TitleEN)</h1>

<div id="dialog_information"></div>

@if (ViewBag.CurrentUser != null)
{
    <div><span id="btn_edit">@Html.ActionLink(BenzInfo.Hockey.LHRAF.Resources.Dictionary.Edit, "Edit")</span></div>
}

<div id="news">
    <div>
        @if (Model.Picture != null)
        {
            <img src="@Url.Content("~/Utils/ImageHandler.ashx?src=posts/" + Model.Picture + "&maxwidth=250&maxheight=500")" title="@(ViewBag.Lang == "fr" ? Model.TitleFR : Model.TitleEN)" alt="@(ViewBag.Lang == "fr" ? Model.TitleFR : Model.TitleEN)"/>
        }
        @Html.Raw(ViewBag.Lang == "fr" ? Model.ContentFR.ToString().Replace("\n", "<br />") : Model.ContentEN.ToString().Replace("\n", "<br />"))
    </div>
    <div class="clear"></div>
</div>
